package it.xiuxian.personcenter.presenter

import com.lzy.okgo.OkGo
import it.xiuxian.lib.base.BaseBean
import it.xiuxian.lib.base.BasePresenter
import it.xiuxian.lib.base.ILoadBind
import it.xiuxian.lib.http.CallBackOption
import it.xiuxian.lib.http.HttpConfig
import it.xiuxian.lib.utils.AESUtils
import it.xiuxian.lib.utils.EncodeUtils
import it.xiuxian.lib.utils.ToastUtil
import it.xiuxian.personcenter.activity.ZhuXiaoActivity
import org.json.JSONObject

class ZhuXiaoActivityPresenter:BasePresenter<ZhuXiaoActivity>() {
    fun subimit(xingming:String,phone:String,amount:String,address:String){
        var json1 = JSONObject()
        json1.put("xingming",xingming)
        json1.put("phone",phone)
        json1.put("address",address)
        json1.put("amount",amount)
        OkGo.post<BaseBean<String>>(HttpConfig.BASE_URL+"/apporderhaibao/tijiao")
            .params("encrypt", AESUtils.encryptAES_ECB(json1.toString()))
            .execute(object : CallBackOption<BaseBean<String>>() {}.loadBind(mView as ZhuXiaoActivity).execute(
                object : ILoadBind<BaseBean<String>> {
                    override fun excute(bean: BaseBean<String>) {
                        if(bean.code==0){
                            ToastUtil.showShort(bean.msg)
                           // (mView as ZhuXiaoActivity).getData(bean.data)
                        }
                    }
                }
            ))
    }
}